package cn.wizzer.util;

import cn.wizzer.app.user.modules.models.enums.PhoneRegularEnum;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 公共类
 */
public class CommonUtil {

    /**
     * 校验手机号格式
     *
     * @param phone 手机号
     * @return
     */
    public static Boolean isPhone(String phone) {
        Matcher matcher;
        for (PhoneRegularEnum value : PhoneRegularEnum.values()) {
            matcher = Pattern.compile(value.getRegular()).matcher(phone);
            if (matcher.find()) {
                return true;
            }
        }
        return false;
    }

}
